<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>反转字符串</title>
</head>
<body>
    
</body>
<script>
    let str = 'abcdefg';
    let strToArr = str.split('');   
    strToArr.reverse();
    let arrToStr = strToArr.join('');
    console.log(arrToStr);
</script>
</html>